#include <stdio.h>
#include "ofc/DTimer.h"

int main(int argc, char *argv[])
{
  DTimer *tmr = [DTimer alloc];

  [tmr init :150];                     // Init with a timeout value of 150 msec

  [tmr restart];                       // Restart the timer

  [DTimer delay :80];                  // Wait 80 msec
                                       // Check if the timer is expired
  printf("Timer %s expired.\n", ([tmr isExpired] ? "is" : "is not"));
  
  printf("Timer time:%ld.\n", [tmr timer]); // Get the current timer time

  [DTimer delay :80];                  // Wait another 80 msec -> 160 msec waited
                                       // Check again if the timer is expired
  printf("Timer %s expired.\n", ([tmr isExpired] ? "is" : "is not"));

  [tmr free];                          // Cleanup

  return 0;
}

